home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 14551 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.4 KB

  1. Path: sydney.DIALix.oz.au!not-for-mail
  2. From: jussi@sydney.DIALix.oz.au (Jussi Jumppanen)
  3. Newsgroups: comp.lang.c,comp.lang.c++
  4. Subject: Re: New printf - like function, is it possible?
  5. Followup-To: comp.lang.c,comp.lang.c++
  6. Date: 31 Mar 1996 20:23:43 +1000
  7. Organization: DIALix Services, Sydney, Australia.
  8. Sender: jussi@sydney.DIALix.oz.au
  9. Message-ID: <4jlmff$jce$1@sydney.DIALix.oz.au>
  10. References: <4eqb3a$2r5@pan.otol.fi> <311240d2.593861@news.demon.co.uk>
  11. NNTP-Posting-Host: jussi@sydney.dialix.oz.au
  12.  
  13. On 1 Feb 1996 12:18:50 GMT, tkes@rhea.otol.fi (Timo Sakari) wrote:
  14.  
  15. >
  16. >Hi!
  17. >
  18. >Do you C-gurus have any solutions to this problem?
  19. >
  20. >I am programming under MS Windows 3.1 (this is NOT an OS spesific 
  21. >question!)and I would like to create
  22. >some kind of modified print function, which syntax should be something
  23. >like normal printf; because in Windows printf can't be used, everything
  24. >printed to screen has to come through message boxes etc, and before 
  25. >displaying anything, the string to displayed has to be formed. I have 
  26. >created my own printing function, which wants parameters string and winID
  27. >to know where to put that string, something like this: 
  28.  
  29. This is the code I use to send output to the debug window using the
  30. va_list functions (compiled on BC4.5)
  31.  
  32.    //-- To use this function in Win31, you must load the device driver
  33.    //-- OX.SYS or the Windows 3.1 utility DBWIN. Use DebugOut just like
  34.    //-- printf function:
  35.    //-- 
  36.    //-- Example: DebugOut("function foo %d %s", myint, mystring);
  37.    
  38.    void DebugOut(char *pszFormat, ...)
  39.    {
  40.       char szBuffer[255];
  41.       
  42.       va_list arg_ptr;
  43.    
  44.       va_start(arg_ptr, pszFormat);
  45.       wvsprintf(szBuffer, pszFormat, arg_ptr);
  46.       va_end(arg_ptr);
  47.       
  48.       OutputDebugString(szBuffer);
  49.    }
  50.    
  51. /-----------------------------------------------------------------------/
  52. /- Jussi Jumppanen (jussi@sydney.dialix.oz.au)                         -/
  53. /-----------------------------------------------------------------------/
  54. /- Author of: Zeus for Windows, Win32 (Brief, WordStar Clone) Editor   -/
  55. /-      garbo.uwasa.fi  :/windows/editor/zeusv200.zip                  -/
  56. /-      SimTel.Coast.NET:/SimTel/nt/editor/ze32v200.zip                -/
  57. /-      SimTel.Coast.NET:/SimTel/win3/editor/zeusv200.zip              -/
  58. /-      http://www.coast.net/SimTel/SimTel/win3/editor/zeusv200.zip    -/
  59. /-----------------------------------------------------------------------/
  60.  
  61.  
  62.  
  63.